﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Groep8
{

    public partial class _Default : Page
    {
        private DataTable dtFestival;
        
        // Uitvoeren stored procedures via de DataAccessLayer om de 2 eerstvolgende festivals op te halen en een willekeurige band.
        protected void Page_Load(object sender, EventArgs e)
        {
            DataAccessLayer d = new DataAccessLayer();
            dtFestival = d.Select("procedure_select_festival_eerste");
            EersteFestivalsList.DataSource = dtFestival;
            EersteFestivalsList.DataBind();

            
            dtFestival = d.Select("GetBands");
            
            Random rand = new Random((int)DateTime.Now.Ticks);
            int numIterations = 0;
            numIterations = rand.Next(1, dtFestival.Rows.Count);
           

            DataAccessLayer d2 = new DataAccessLayer();
            dtFestival = d2.Select("GetBand", numIterations);
            
            FeaturedBandDetail.DataSource = dtFestival;
            FeaturedBandDetail.DataBind();

        }
    }
    
}